#include "depproperty.h"

#include <QtGui>
#include "dep.h"

void depproperty::setDep1(dep *dep1)
{
    this->mydep1 = dep1;
}

dep* depproperty::getDep1()
{
    return this->mydep1;
}


/*blockproperty::blockproperty(const node* &block1)
{
    this->setBlock1(block1);
}*/

void depproperty::cdf_failure_active_accept()
{
    if(this->cdf_failure_active == true)//si devono salvare i dati della cdf per lo stato failure
    {
        this->myblock1->getBlock()->getFailureDep()->setCdf(this->comboBox->currentText(), this, 1);
    }
    else//si devono salvare i dat della cdf per lo stato active
    {
        this->myblock1->getBlock()->getActiveDep()->setCdf(this->comboBox->currentText(), this, 1);
    }
}


 void depproperty::id_accept()
{

/*     mydep1->getDip()->setTriggerEvType(this->lineEdit_5->text());
     mydep1->getDip()->setReactionEvType(this->lineEdit_6->text());
     mydep1->getDip()->setPropProbability(this->lineEdit_8->text());
     mydep1->getDip()->setPriority(this->lineEdit_7->text());
     mydep1->setIsSet(true);*/

    switch(this->numDep)
    {
    case 1:
            mydep1->getXmlDepList()->at(0)->setTriggerEvType(this->lineEdit_5->text());
            mydep1->getXmlDepList()->at(0)->setReactionEvType(this->lineEdit_6->text());
            mydep1->getXmlDepList()->at(0)->setPropProbability(this->lineEdit_8->text());
            mydep1->getXmlDepList()->at(0)->setPriority(this->lineEdit_7->text());//eliminare
            mydep1->getXmlDepList()->at(0)->setCdf(this->comboBox->currentText(), this, 1);
            mydep1->setIsSet(true);
            break;
    case 2:
            mydep1->getXmlDepList()->at(0)->setTriggerEvType(this->lineEdit_5->text());
            mydep1->getXmlDepList()->at(0)->setReactionEvType(this->lineEdit_6->text());
            mydep1->getXmlDepList()->at(0)->setPropProbability(this->lineEdit_8->text());
            mydep1->getXmlDepList()->at(0)->setPriority(this->lineEdit_7->text());//eliminare
            mydep1->getXmlDepList()->at(0)->setCdf(this->comboBox->currentText(), this, 1);

            mydep1->getXmlDepList()->at(1)->setTriggerEvType(this->lineEdit_9->text());
            mydep1->getXmlDepList()->at(1)->setReactionEvType(this->lineEdit_10->text());
            mydep1->getXmlDepList()->at(1)->setPropProbability(this->lineEdit_12->text());
            mydep1->getXmlDepList()->at(1)->setPriority(this->lineEdit_11->text());//eliminare
            mydep1->getXmlDepList()->at(1)->setCdf(this->comboBox_2->currentText(), this, 2);
            mydep1->setIsSet(true);
            break;
    case 3:
            mydep1->getXmlDepList()->at(0)->setTriggerEvType(this->lineEdit_5->text());
            mydep1->getXmlDepList()->at(0)->setReactionEvType(this->lineEdit_6->text());
            mydep1->getXmlDepList()->at(0)->setPropProbability(this->lineEdit_8->text());
            mydep1->getXmlDepList()->at(0)->setPriority(this->lineEdit_7->text());
            mydep1->getXmlDepList()->at(0)->setCdf(this->comboBox->currentText(), this, 1);

            mydep1->getXmlDepList()->at(1)->setTriggerEvType(this->lineEdit_9->text());
            mydep1->getXmlDepList()->at(1)->setReactionEvType(this->lineEdit_10->text());
            mydep1->getXmlDepList()->at(1)->setPropProbability(this->lineEdit_12->text());
            mydep1->getXmlDepList()->at(1)->setPriority(this->lineEdit_11->text());
            mydep1->getXmlDepList()->at(1)->setCdf(this->comboBox_2->currentText(), this, 2);

            mydep1->getXmlDepList()->at(2)->setTriggerEvType(this->lineEdit_13->text());
            mydep1->getXmlDepList()->at(2)->setReactionEvType(this->lineEdit_14->text());
            mydep1->getXmlDepList()->at(2)->setPropProbability(this->lineEdit_16->text());
            mydep1->getXmlDepList()->at(2)->setPriority(this->lineEdit_15->text());
            mydep1->getXmlDepList()->at(2)->setCdf(this->comboBox_3->currentText(), this, 3);
            mydep1->setIsSet(true);
            break;
    case 4:
            mydep1->getXmlDepList()->at(0)->setTriggerEvType(this->lineEdit_5->text());
            mydep1->getXmlDepList()->at(0)->setReactionEvType(this->lineEdit_6->text());
            mydep1->getXmlDepList()->at(0)->setPropProbability(this->lineEdit_8->text());
            mydep1->getXmlDepList()->at(0)->setPriority(this->lineEdit_7->text());
            mydep1->getXmlDepList()->at(0)->setCdf(this->comboBox->currentText(), this, 1);

            mydep1->getXmlDepList()->at(1)->setTriggerEvType(this->lineEdit_9->text());
            mydep1->getXmlDepList()->at(1)->setReactionEvType(this->lineEdit_10->text());
            mydep1->getXmlDepList()->at(1)->setPropProbability(this->lineEdit_12->text());
            mydep1->getXmlDepList()->at(1)->setPriority(this->lineEdit_11->text());
            mydep1->getXmlDepList()->at(1)->setCdf(this->comboBox_2->currentText(), this, 2);

            mydep1->getXmlDepList()->at(2)->setTriggerEvType(this->lineEdit_13->text());
            mydep1->getXmlDepList()->at(2)->setReactionEvType(this->lineEdit_14->text());
            mydep1->getXmlDepList()->at(2)->setPropProbability(this->lineEdit_16->text());
            mydep1->getXmlDepList()->at(2)->setPriority(this->lineEdit_15->text());
            mydep1->getXmlDepList()->at(2)->setCdf(this->comboBox_3->currentText(), this, 3);

            mydep1->getXmlDepList()->at(3)->setTriggerEvType(this->lineEdit_17->text());
            mydep1->getXmlDepList()->at(3)->setReactionEvType(this->lineEdit_18->text());
            mydep1->getXmlDepList()->at(3)->setPropProbability(this->lineEdit_20->text());
            mydep1->getXmlDepList()->at(3)->setPriority(this->lineEdit_19->text());
            mydep1->getXmlDepList()->at(3)->setCdf(this->comboBox_4->currentText(), this, 4);
            mydep1->setIsSet(true);
            break;
    case 5:
            mydep1->getXmlDepList()->at(0)->setTriggerEvType(this->lineEdit_5->text());
            mydep1->getXmlDepList()->at(0)->setReactionEvType(this->lineEdit_6->text());
            mydep1->getXmlDepList()->at(0)->setPropProbability(this->lineEdit_8->text());
            mydep1->getXmlDepList()->at(0)->setPriority(this->lineEdit_7->text());
            mydep1->getXmlDepList()->at(0)->setCdf(this->comboBox->currentText(), this, 1);

            mydep1->getXmlDepList()->at(1)->setTriggerEvType(this->lineEdit_9->text());
            mydep1->getXmlDepList()->at(1)->setReactionEvType(this->lineEdit_10->text());
            mydep1->getXmlDepList()->at(1)->setPropProbability(this->lineEdit_12->text());
            mydep1->getXmlDepList()->at(1)->setPriority(this->lineEdit_11->text());
            mydep1->getXmlDepList()->at(1)->setCdf(this->comboBox_2->currentText(), this, 2);

            mydep1->getXmlDepList()->at(2)->setTriggerEvType(this->lineEdit_13->text());
            mydep1->getXmlDepList()->at(2)->setReactionEvType(this->lineEdit_14->text());
            mydep1->getXmlDepList()->at(2)->setPropProbability(this->lineEdit_16->text());
            mydep1->getXmlDepList()->at(2)->setPriority(this->lineEdit_15->text());
            mydep1->getXmlDepList()->at(2)->setCdf(this->comboBox_3->currentText(), this, 3);

            mydep1->getXmlDepList()->at(3)->setTriggerEvType(this->lineEdit_17->text());
            mydep1->getXmlDepList()->at(3)->setReactionEvType(this->lineEdit_18->text());
            mydep1->getXmlDepList()->at(3)->setPropProbability(this->lineEdit_20->text());
            mydep1->getXmlDepList()->at(3)->setPriority(this->lineEdit_19->text());
            mydep1->getXmlDepList()->at(3)->setCdf(this->comboBox_4->currentText(), this, 4);

            mydep1->getXmlDepList()->at(4)->setTriggerEvType(this->lineEdit_21->text());
            mydep1->getXmlDepList()->at(4)->setReactionEvType(this->lineEdit_22->text());
            mydep1->getXmlDepList()->at(4)->setPropProbability(this->lineEdit_24->text());
            mydep1->getXmlDepList()->at(4)->setPriority(this->lineEdit_23->text());
            mydep1->getXmlDepList()->at(4)->setCdf(this->comboBox_5->currentText(), this, 5);
            mydep1->setIsSet(true);
            break;

    }

}


 depproperty::depproperty(node *myblock1, bool fa)
 {
     this->numDep = 1;
     this->cdf_failure_active = fa;
     this->myblock1 = myblock1;
     setupUi(this);

     this->lineEdit_5->setVisible(false);
     this->lineEdit_6->setVisible(false);
     this->lineEdit_7->setVisible(false);
     this->lineEdit_8->setVisible(false);
     this->label_6->setVisible(false);
     this->label_8->setVisible(false);
     this->label_7->setVisible(false);
     this->label_9->setVisible(false);
     this->pushButtonHelp1->setVisible(false);
     this->tabWidget->resize(300, 200);
     this->tabWidget->removeTab(4);
     this->tabWidget->removeTab(3);
     this->tabWidget->removeTab(2);
     this->tabWidget->removeTab(1);

     this->groupBox_erlang->hide();
     this->groupBox_uniforme->hide();
     this->groupBox_weibull->hide();

     connect(pushButton_3, SIGNAL(clicked()), this, SLOT(cdf_failure_active_accept()));
     connect(pushButton_3, SIGNAL(clicked()), this, SLOT(accept()));
     connect(pushButton_4, SIGNAL(clicked()), this, SLOT(reject()));
     connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox_currentIndexChanged(int)));
 }

 depproperty::depproperty(dep *dep1, int numDep, node *myblock1, QWidget *parent) : QDialog(parent)
{
    this->numDep=numDep;
    this->setDep1(dep1);
    this->myblock1 = myblock1;
    setupUi(this);

    this->signalMapper = new QSignalMapper(this);

    connect(pushButtonHelp1, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(pushButtonHelp1, 1);

    connect(pushButtonHelp2, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(pushButtonHelp2, 2);

    connect(pushButtonHelp3, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(pushButtonHelp3, 3);

    connect(pushButtonHelp4, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(pushButtonHelp4, 4);

    connect(pushButtonHelp5, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(pushButtonHelp5, 5);

    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(helpButtonClicked(int)));


    //all'inizio nascondo tutti groupBox per i parametri CDF che verrano mostrati
    //solo se l'utente clicca sul comboBox CDF
    this->groupBox_erlang->hide();
    this->groupBox_uniforme->hide();
    this->groupBox_weibull->hide();

    this->groupBox_erlang_2->hide();
    this->groupBox_uniforme_2->hide();
    this->groupBox_weibull_2->hide();

    this->groupBox_erlang_3->hide();
    this->groupBox_uniforme_3->hide();
    this->groupBox_weibull_3->hide();

    this->groupBox_erlang_4->hide();
    this->groupBox_uniforme_4->hide();
    this->groupBox_weibull_4->hide();

    this->groupBox_erlang_5->hide();
    this->groupBox_uniforme_5->hide();
    this->groupBox_weibull_5->hide();
    //QWidget * widget = (QWidget *) this->verticalLayout_4;
    //int index = this->tabWidget->addTab(widget, "Dep2");

    //QWidget * widget = new QWidget();
    for (int i=0; i<5-numDep; i++)
        this->tabWidget->removeTab(4-i);

    //int index2 = this->tabWidget->addTab(Ui::Form3::layoutWidget, "asd");

   //devo fare una serie di controlli if(numDip ==2/3/4/5)....

        connect(pushButton_3, SIGNAL(clicked()), this, SLOT(id_accept()));
        connect(pushButton_3, SIGNAL(clicked()), this, SLOT(accept()));
        connect(pushButton_4, SIGNAL(clicked()), this, SLOT(reject()));
        connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox_currentIndexChanged(int)));

        switch(numDep)
        {
            case 2:
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_6, SIGNAL(clicked()), this, SLOT(reject()));

                connect(comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox2_currentIndexChanged(int)));
                break;

            case 3:
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_6, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_8, SIGNAL(clicked()), this, SLOT(reject()));

                connect(comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox2_currentIndexChanged(int)));
                connect(comboBox_3, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox3_currentIndexChanged(int)));

                break;

            case 4:
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_6, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_8, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_9, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_9, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_10, SIGNAL(clicked()), this, SLOT(reject()));

                connect(comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox2_currentIndexChanged(int)));
                connect(comboBox_3, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox3_currentIndexChanged(int)));
                connect(comboBox_4, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox4_currentIndexChanged(int)));

                break;

            case 5:
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_5, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_6, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_7, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_8, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_9, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_9, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_10, SIGNAL(clicked()), this, SLOT(reject()));
                connect(pushButton_11, SIGNAL(clicked()), this, SLOT(id_accept()));
                connect(pushButton_11, SIGNAL(clicked()), this, SLOT(accept()));
                connect(pushButton_12, SIGNAL(clicked()), this, SLOT(reject()));

                connect(comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox2_currentIndexChanged(int)));
                connect(comboBox_3, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox3_currentIndexChanged(int)));
                connect(comboBox_4, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox4_currentIndexChanged(int)));
                connect(comboBox_5, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBox5_currentIndexChanged(int)));

                break;
        }



}


void depproperty::on_lineEdit_textChanged()
{
    pushButton_3->setEnabled(lineEdit_5->hasAcceptableInput());
    pushButton_3->setEnabled(lineEdit_6->hasAcceptableInput());
    pushButton_3->setEnabled(lineEdit_7->hasAcceptableInput());
    pushButton_3->setEnabled(lineEdit_8->hasAcceptableInput());
}

void depproperty::comboBox_currentIndexChanged(int currentIndex)
{
    QString cdfSelected = this->comboBox->itemText(currentIndex);

    if(cdfSelected == "Weibull")
    {
        this->groupBox_erlang->hide();
        this->groupBox_uniforme->hide();

        this->groupBox_weibull->setVisible(true);
    }
    else if(cdfSelected == "Erlang")
    {
        this->groupBox_weibull->hide();
        this->groupBox_uniforme->hide();
        this->groupBox_erlang->setVisible(true);
    }
    else if(cdfSelected == "Uniforme")
    {
        this->groupBox_erlang->hide();
        this->groupBox_weibull->hide();
        this->groupBox_uniforme->setVisible(true);
    }

}

void depproperty::comboBox2_currentIndexChanged(int currentIndex)
{
    QString cdfSelected = this->comboBox_2->itemText(currentIndex);

    if(cdfSelected == "Weibull")
    {
        this->groupBox_erlang_2->hide();
        this->groupBox_uniforme_2->hide();

        this->groupBox_weibull_2->setVisible(true);
    }
    else if(cdfSelected == "Erlang")
    {
        this->groupBox_weibull_2->hide();
        this->groupBox_uniforme_2->hide();
        this->groupBox_erlang_2->setVisible(true);
    }
    else if(cdfSelected == "Uniforme")
    {
        this->groupBox_erlang_2->hide();
        this->groupBox_weibull_2->hide();
        this->groupBox_uniforme_2->setVisible(true);
    }
}

void depproperty::comboBox3_currentIndexChanged(int currentIndex)
{
    QString cdfSelected = this->comboBox_3->itemText(currentIndex);

    if(cdfSelected == "Weibull")
    {
        this->groupBox_erlang_3->hide();
        this->groupBox_uniforme_3->hide();

        this->groupBox_weibull_3->setVisible(true);
    }
    else if(cdfSelected == "Erlang")
    {
        this->groupBox_weibull_3->hide();
        this->groupBox_uniforme_3->hide();
        this->groupBox_erlang_3->setVisible(true);
    }
    else if(cdfSelected == "Uniforme")
    {
        this->groupBox_erlang_3->hide();
        this->groupBox_weibull_3->hide();
        this->groupBox_uniforme_3->setVisible(true);
    }
}

void depproperty::comboBox4_currentIndexChanged(int currentIndex)
{
    QString cdfSelected = this->comboBox_4->itemText(currentIndex);

    if(cdfSelected == "Weibull")
    {
        this->groupBox_erlang_4->hide();
        this->groupBox_uniforme_4->hide();

        this->groupBox_weibull_4->setVisible(true);
    }
    else if(cdfSelected == "Erlang")
    {
        this->groupBox_weibull_4->hide();
        this->groupBox_uniforme_4->hide();
        this->groupBox_erlang_4->setVisible(true);
    }
    else if(cdfSelected == "Uniforme")
    {
        this->groupBox_erlang_4->hide();
        this->groupBox_weibull_4->hide();
        this->groupBox_uniforme_4->setVisible(true);
    }
}

void depproperty::comboBox5_currentIndexChanged(int currentIndex)
{
    QString cdfSelected = this->comboBox_5->itemText(currentIndex);

    if(cdfSelected == "Weibull")
    {
        this->groupBox_erlang_5->hide();
        this->groupBox_uniforme_5->hide();

        this->groupBox_weibull_5->setVisible(true);
    }
    else if(cdfSelected == "Erlang")
    {
        this->groupBox_weibull_5->hide();
        this->groupBox_uniforme_5->hide();
        this->groupBox_erlang_5->setVisible(true);
    }
    else if(cdfSelected == "Uniforme")
    {
        this->groupBox_erlang_5->hide();
        this->groupBox_weibull_5->hide();
        this->groupBox_uniforme_5->setVisible(true);
    }
}

void depproperty::setGroupBoxCdf(cdf *distribution, int num_dep)
{
    QString typeCdf = distribution->getType();

    switch(num_dep)
    {
    case 1:
        if(typeCdf == "Weibull")
        {
            cdfWeibull *d = (cdfWeibull *)distribution;
            this->lineEdit_kappa->setText(d->getKappa());
            this->lineEdit_lambda->setText(d->getLambda());
            this->comboBox->setCurrentIndex(this->comboBox->findText("Weibull", Qt::MatchExactly));
            this->groupBox_weibull->show();
        }
        else if(typeCdf == "Erlang")
        {
            cdfErlang *d = (cdfErlang *)distribution;
            this->lineEdit_alfa->setText(d->getAlfa());
            this->lineEdit_erre->setText(d->getErre());
            this->comboBox->setCurrentIndex(this->comboBox->findText("Erlang", Qt::MatchExactly));
            this->groupBox_erlang->show();
        }
        else if(typeCdf == "Uniforme")
        {
            cdfUniforme *d = (cdfUniforme *)distribution;
            this->lineEdit_a->setText(d->getA());
            this->lineEdit_b->setText(d->getB());
            this->comboBox->setCurrentIndex(this->comboBox->findText("Uniforme", Qt::MatchExactly));
            this->groupBox_uniforme->show();
        }
        else if(typeCdf == "Not repairable")
        {
            this->comboBox->setCurrentIndex(this->comboBox->findText("Not repairable", Qt::MatchExactly));
            this->groupBox_erlang->hide();
            this->groupBox_uniforme->hide();
            this->groupBox_weibull->hide();

        }

        break;

    case 2:
        if(typeCdf == "Weibull")
        {
            cdfWeibull *d = (cdfWeibull *)distribution;
            this->lineEdit_kappa_2->setText(d->getKappa());
            this->lineEdit_lambda_2->setText(d->getLambda());
            this->comboBox_2->setCurrentIndex(this->comboBox_2->findText("Weibull", Qt::MatchExactly));
            this->groupBox_weibull_2->show();
        }
        else if(typeCdf == "Erlang")
        {
            cdfErlang *d = (cdfErlang *)distribution;
            this->lineEdit_alfa_3->setText(d->getAlfa());
            this->lineEdit_erre_3->setText(d->getErre());
            this->comboBox_2->setCurrentIndex(this->comboBox_2->findText("Erlang", Qt::MatchExactly));
            this->groupBox_erlang_2->show();
        }
        else if(typeCdf == "Uniforme")
        {
            cdfUniforme *d = (cdfUniforme *)distribution;
            this->lineEdit_a_2->setText(d->getA());
            this->lineEdit_b_2->setText(d->getB());
            this->comboBox_2->setCurrentIndex(this->comboBox_2->findText("Uniforme", Qt::MatchExactly));
            this->groupBox_uniforme_2->show();
        }
        else if(typeCdf == "Not repairable")
        {
            this->comboBox_2->setCurrentIndex(this->comboBox_2->findText("Not repairable", Qt::MatchExactly));
            this->groupBox_erlang_2->hide();
            this->groupBox_uniforme_2->hide();
            this->groupBox_weibull_2->hide();

        }

        break;

    case 3:
        if(typeCdf == "Weibull")
        {
            cdfWeibull *d = (cdfWeibull *)distribution;
            this->lineEdit_kappa_3->setText(d->getKappa());
            this->lineEdit_lambda_3->setText(d->getLambda());
            this->comboBox_3->setCurrentIndex(this->comboBox_3->findText("Weibull", Qt::MatchExactly));
            this->groupBox_weibull_3->show();
        }
        else if(typeCdf == "Erlang")
        {
            cdfErlang *d = (cdfErlang *)distribution;
            this->lineEdit_alfa_4->setText(d->getAlfa());
            this->lineEdit_erre_4->setText(d->getErre());
            this->comboBox_3->setCurrentIndex(this->comboBox_3->findText("Erlang", Qt::MatchExactly));
            this->groupBox_erlang_3->show();
        }
        else if(typeCdf == "Uniforme")
        {
            cdfUniforme *d = (cdfUniforme *)distribution;
            this->lineEdit_a_3->setText(d->getA());
            this->lineEdit_b_3->setText(d->getB());
            this->comboBox_3->setCurrentIndex(this->comboBox_3->findText("Uniforme", Qt::MatchExactly));
            this->groupBox_uniforme_3->show();
        }
        else if(typeCdf == "Not repairable")
        {
            this->comboBox_3->setCurrentIndex(this->comboBox_3->findText("Not repairable", Qt::MatchExactly));
            this->groupBox_erlang_3->hide();
            this->groupBox_uniforme_3->hide();
            this->groupBox_weibull_3->hide();

        }

        break;

    case 4:
        if(typeCdf == "Weibull")
        {
            cdfWeibull *d = (cdfWeibull *)distribution;
            this->lineEdit_kappa_4->setText(d->getKappa());
            this->lineEdit_lambda_4->setText(d->getLambda());
            this->comboBox_4->setCurrentIndex(this->comboBox_4->findText("Weibull", Qt::MatchExactly));
            this->groupBox_weibull_4->show();
        }
        else if(typeCdf == "Erlang")
        {
            cdfErlang *d = (cdfErlang *)distribution;
            this->lineEdit_alfa_5->setText(d->getAlfa());
            this->lineEdit_erre_5->setText(d->getErre());
            this->comboBox_4->setCurrentIndex(this->comboBox_4->findText("Erlang", Qt::MatchExactly));
            this->groupBox_erlang_4->show();
        }
        else if(typeCdf == "Uniforme")
        {
            cdfUniforme *d = (cdfUniforme *)distribution;
            this->lineEdit_a_4->setText(d->getA());
            this->lineEdit_b_4->setText(d->getB());
            this->comboBox_4->setCurrentIndex(this->comboBox_4->findText("Uniforme", Qt::MatchExactly));
            this->groupBox_uniforme_4->show();
        }
        else if(typeCdf == "Not repairable")
        {
            this->comboBox_4->setCurrentIndex(this->comboBox_4->findText("Not repairable", Qt::MatchExactly));
            this->groupBox_erlang_4->hide();
            this->groupBox_uniforme_4->hide();
            this->groupBox_weibull_4->hide();

        }

        break;

    case 5:
        if(typeCdf == "Weibull")
        {
            cdfWeibull *d = (cdfWeibull *)distribution;
            this->lineEdit_kappa_5->setText(d->getKappa());
            this->lineEdit_lambda_5->setText(d->getLambda());
            this->comboBox_5->setCurrentIndex(this->comboBox_5->findText("Weibull", Qt::MatchExactly));
            this->groupBox_weibull_5->show();
        }
        else if(typeCdf == "Erlang")
        {
            cdfErlang *d = (cdfErlang *)distribution;
            this->lineEdit_alfa_6->setText(d->getAlfa());
            this->lineEdit_erre_6->setText(d->getErre());
            this->comboBox_5->setCurrentIndex(this->comboBox_5->findText("Erlang", Qt::MatchExactly));
            this->groupBox_erlang_5->show();
        }
        else if(typeCdf == "Uniforme")
        {
            cdfUniforme *d = (cdfUniforme *)distribution;
            this->lineEdit_a_5->setText(d->getA());
            this->lineEdit_b_5->setText(d->getB());
            this->comboBox_5->setCurrentIndex(this->comboBox_5->findText("Uniforme", Qt::MatchExactly));
            this->groupBox_uniforme_5->show();
        }
        else if(typeCdf == "Not repairable")
        {
            this->comboBox_5->setCurrentIndex(this->comboBox_5->findText("Not repairable", Qt::MatchExactly));
            this->groupBox_erlang_5->hide();
            this->groupBox_uniforme_5->hide();
            this->groupBox_weibull_5->hide();

        }

        break;
    }
}

void depproperty::helpButtonClicked(int id)
{
    triggerstateproperty *dialog;

    switch(id)
    {
    case 1:
        dialog = new triggerstateproperty(this->myblock1, lineEdit_5, this->mydep1);
        dialog->show();
        break;

    case 2:
        dialog = new triggerstateproperty(this->myblock1, lineEdit_9, this->mydep1);
        dialog->show();
        break;

    case 3:
        dialog = new triggerstateproperty(this->myblock1, lineEdit_13, this->mydep1);
        dialog->show();
        break;

    case 4:
        dialog = new triggerstateproperty(this->myblock1, lineEdit_17, this->mydep1);
        dialog->show();
        break;

    case 5:
        dialog = new triggerstateproperty(this->myblock1, lineEdit_21, this->mydep1);
        dialog->show();
        break;
    }

}
